<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/common/common.jsp" %>
</head>
<body>
<!-- #section:basics/navbar -->
<div id="navbar" class="navbar navbar-default">
    <script type="text/javascript">
        try {
            ace.settings.check('navbar', 'fixed')
        } catch (e) {
        }
    </script>
    <div class="navbar-container" id="navbar-container">
        <!-- /section:basics/sidebar.mobile.toggle -->
        <div class="navbar-header pull-left">
            <!-- #section:basics/navbar.layout.brand -->
            <a href="#" class="navbar-brand">
                <small>
                    冀银科技
                </small>
            </a>
        </div>
        <!-- #section:basics/navbar.dropdown -->
        <div class="navbar-header pull-right" role="navigation">
            <ul class="nav ace-nav">
                <!-- #section:basics/navbar.user_menu -->
                <li class="light-blue">
                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                        <img class="nav-user-photo" src="assets/avatars/user.jpg" alt="Jason's Photo">
                        <span class="user-info">
									<small>欢迎光临,</small>
									${userName}
								</span>

                        <i class="icon-caret-down"></i>
                    </a>

                    <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                        <li>
                            <a href="${basePath}/logout">
                                <i class="icon-off"></i>
                                退出
                            </a>
                        </li>
                    </ul>
                </li>
                <!-- /section:basics/navbar.user_menu -->
            </ul>
        </div>

        <!-- /section:basics/navbar.dropdown -->
    </div><!-- /.navbar-container -->
</div>

<!-- /section:main-container -->
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>
    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>
        <!-- #section:basics/sidebar -->
        <div id="sidebar" class="sidebar">
            <script type="text/javascript">
                try {
                    ace.settings.check('sidebar', 'fixed')
                } catch (e) {
                }
            </script>
            <nav>
                <ul class="nav nav-list">
                    <c:forEach items="${resources}" var="res">
                        <li class="active">
                            <a href="${res.resourceUrl}" id="homePage" name="${res.resourceName}">
                                <i class="menu-icon fa fa-tachometer"></i>
                                <span class=""> ${res.resourceName}</span>
                            </a>

                        </li>

                        <c:if test="${fn:length(res.childRes)!=0 }">
                            <c:forEach items="${res.childRes }" var="res1">
                                <li class="active open">
                                    <a href="#" class="dropdown-toggle">
                                        <c:choose>
                                            <c:when test="${res1.resourceStyle==null}">
                                                <i class="menu-icon fa fa-list"></i>
                                            </c:when>
                                            <c:otherwise>
                                                <i class="menu-icon fa ${res1.resourceStyle}"></i>
                                            </c:otherwise>
                                        </c:choose>
                                        <span class="menu-text"> ${res1.resourceName} </span>
                                        <b class="arrow fa fa-angle-down"></b>
                                    </a>

                                    <c:if test="${fn:length(res1.childRes)!=0 }">
                                        <ul class="submenu">
                                            <c:forEach items="${res1.childRes }" var="res2">
                                                <li>
                                                    <a href="${res2.resourceUrl}" class="J_menuItem"
                                                       name="${res2.resourceName}">
                                                        <i class="icon-double-angle-right"></i>
                                                            ${res2.resourceName}
                                                    </a>

                                                </li>
                                            </c:forEach>
                                        </ul>
                                    </c:if>
                                </li>
                            </c:forEach>
                        </c:if>
                    </c:forEach>
                </ul>
            </nav><!-- /.nav-list -->
            <script type="text/javascript">
                try {
                    ace.settings.check('sidebar', 'collapsed')
                } catch (e) {
                }
            </script>
        </div>

        <!-- /section:basics/sidebar -->
        <div class="main-content">
            <!-- #section:basics/content.breadcrumbs -->
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa fa-home home-icon"></i>
                        <a href="${resources[0].resourceUrl}" id="home" name="${resources[0].resourceName}">首页</a>
                    </li>
                    <li class="active" id="tabName">${resources[0].resourceName}</li>
                </ul>
                <script type="text/javascript">
                    try {
                        ace.settings.check('breadcrumbs', 'fixed')
                    } catch (e) {
                    }
                </script>
            </div>
            <div id="loadhtml"></div>
        </div><!-- /.main-content -->
    </div>
    <%--  <div class="footer">
          <div class="footer-inner">
              <!-- #section:basics/footer -->
              <div class="footer-content">
                  <span class="bigger-120">
                      <span class="blue bolder">冀银科技</span>
                      Application &copy; 2013-2014
                  </span>
              </div>

              <!-- /section:basics/footer -->
          </div>
      </div>--%>
</div><!-- /.main-container -->

<script type="text/javascript">
    jQuery(function ($) {
        var tb = $("#loadhtml");
        tb.load("index/homePage");
        $('.J_menuItem').on('click', menuItem);
        $('#homePage').on('click', menuItem);
        $('#home').on('click', menuItem);

    });
    function menuItem() {
        // 获取标识数据
        var dataUrl = $(this).attr('href');
        var name = $(this).attr('name');
        if (dataUrl == undefined || $.trim(dataUrl).length == 0)return false;
        var tb = $("#loadhtml");
        tb.load(dataUrl);
        $(".submenu").find("li").removeClass("active");
        $(this).parent("li").addClass("active");
        $("#tabName").text(name);
        return false;
    }
</script>
</body>
</html>
